#include "ustandard/ustandard_def.h"
static jmp_buf env;

int set_exit(void)
{
    int ret = 0;

    if(0 == setjmp(env)) {
        uloginf("set jmp OK.\n");
    }
    else {
        uloginf("clear all resource.\n");
    }

    return ret;
}


void f(int n) 
{
    if (setjmp(env) == 0)
        printf("divide return %lf\n", divide(2, n));
    else
        printf("Cannot / 0.\n");

    printf("done.\n");
}


int n = 2;
int main()
{
    while(1) {
        uloginf("n = %d \n", n);
        
        n --;
        sleep(1);

        set_exit();
    }
}
